function test() {
	alert("Hello!");
}

function replyTo(evt,mid, rid) {
	window.linkControls.replyTo(evt,mid,rid);
}

function setLinksClickHandler() {
	$("a").click( function(event) {

		if (this.protocol == "xmpp:") {
			event.preventDefault();
			window.linkControls.handleXMPPLink(this);
			return;
		}

		if (this.protocol == "javascript:") {
			event.preventDefault();
			window.linkControls.handleJavascriptLink(this);
			return;
		}

		window.linkControls.handleGeneralLink(this);
	});

	
	// Set reply links on post page for links like "#1213/32" from Javascript 
	var liaves = $('.liav > small').each(function(){return this});

	for ( var i=0; i<liaves.length; i++ )
	{
	    var srcHTML = liaves[i].innerHTML;
	    liaves[i].innerHTML = srcHTML.replace(/#(\d+)<b>\/(\d+)<\/b>/, '<a href="javascript:replyTo(this,$1,$2)">Reply to #$1/$2</a>');
	}
	
	// Add reply links on the friends page to links like:
	// <small><a href="/sg/251341">#251341</a>
	
	var postLinks = $('.liav small');
	
	for ( var i=0; i<postLinks.length; i++ )
	{
		var srcHTML = postLinks[i].innerHTML;
		postLinks[i].innerHTML = srcHTML.replace(/#(\d+)<\/a>/, '$1</a> - <a class="replyLink" href="javascript:replyTo(this,$1)"><b>Reply</b></a>');
	}

	//Add reply links on the blog pages like http://juick.com/rostag/
	postLinks = $('#content small');
	
	for ( var i=0; i<postLinks.length; i++ )
	{
		var srcHTML = postLinks[i].innerHTML;
		postLinks[i].innerHTML = srcHTML.replace(/#(\d+)<\/a>/, '$1</a> - <a class="replyLink" href="javascript:replyTo(this,$1)"><b>Reply</b></a>');
	}
	
	
}

setLinksClickHandler();